package com.polaris.live.ui.party

import com.polaris.live.common.util.ToastGravity
import com.polaris.live.translation.R.string

/**
 * 派对房用户状态记录
 * @author Created by 天晴 on 2024/3/26 14:23
 * @since 1.0.0
 **/
object PartyUserStateUtil {

    /**
     * 房主 语聊和游戏房
     */
    var master = false

    /**
     * 在游戏中
     */
    var inTheGame = false

    /**
     * 在麦位
     */
    var inTheMaiSeat = false

    /**
     * 麦位当前状态  0闭麦 1开麦 2禁麦  null 未上麦
     */
    var siteMicStatus: Int? = null

    /**
     * 在游戏位
     */
    var inTheGameSeat = false

    /**
     * 检查是否提示
     */
    fun clickUser(): Boolean {
        val errorMessage = when {
            master -> string.master_cannot_leave_room
            inTheGame || inTheGameSeat -> string.players_cannot_leave_room
            inTheMaiSeat -> string.seat_cannot_leave_room
            else -> null
        }
        return if (errorMessage != null) {
            ToastGravity.showGravity(errorMessage)
            false
        } else {
            true
        }
    }

    //是否可以继续操作之类  比如转跳
    fun isGoOtherRouter(): Boolean {
        return !(master || inTheGame || inTheMaiSeat || inTheGameSeat)
    }

}